//
//  SMACCommen.swift
//  SmiraAiChat
//
//  Created by mumu on 2024/9/20.
//

import UIKit
extension Double {
    
    var x_bili: CGFloat {
        return UIScreen.main.bounds.width * CGFloat(self) / 375.0
    }
    
    var y_bili: CGFloat {
        return UIScreen.main.bounds.height * CGFloat(self) / 812.0
    }
}
class SMACCommen: NSObject {//ASMpublicer
   
    
    static let appName_SMAC: String = Bundle.main.infoDictionary!["CFBundleDisplayName"] as? String ?? ""

    static let priLink_SMAC = "http://baidu.com"
    static let termlink_SMAC =  "http://baidu.com"
    static let contackLink_SMAC =  "http://baidu.com"
 
    static let scrwid_SMAC = UIScreen.main.bounds.width
    static let scrheig_SMAC = UIScreen.main.bounds.height
    
    static var bottomSafehit_SMAC:CGFloat {
      
        let scene = UIApplication.shared.connectedScenes.first
                  
        guard let windowScene = scene as? UIWindowScene,let window = windowScene.windows.first else { return 0 }
        return window.safeAreaInsets.bottom
    }
    
    static var smac_time_interval:CGFloat {
        
        let scene = UIApplication.shared.connectedScenes.first
                  
        guard let windowScene = scene as? UIWindowScene,let window = windowScene.windows.first else { return 0 }
        return window.safeAreaInsets.top
    }
 

    static func get_TopShowingController_SMAC()
    ->UIViewController?{
        if let rootViewController = UIApplication.shared.windows.first?.rootViewController {
            var currentViewController = rootViewController
            while let presentedViewController = currentViewController.presentedViewController {
                currentViewController = presentedViewController
            }
            
            return currentViewController
           
        }
        
        return nil
    }

}
